package com.crm.service.impl;

import com.crm.dao.BasicTypeMapper;
import com.crm.domain.DataGridView;
import com.crm.pojo.BasicType;
import com.crm.service.BasicTypeService;
import com.crm.vo.BasicTypeVo;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class BasicTypeServiceImpl implements BasicTypeService {
    @Autowired
    private BasicTypeMapper basicTypeMapper;
    @Override
    public List<BasicType> findAllBasicTypes() {
        return basicTypeMapper.selectAllBasicTypes();
    }

    @Override
    public DataGridView getBasicTypeByPage(BasicTypeVo basicTypeVo) {
        Page<Object> page= PageHelper.startPage(basicTypeVo.getPage(),basicTypeVo.getLimit());
        List<BasicType> data=this.basicTypeMapper.selectBasicTypeByProperty(basicTypeVo);
        return new DataGridView(page.getTotal(),data);
    }
}
